package com.vilen.weixin.web.servlet;

import com.vilen.basic.util.PropertiesUtil;
import com.vilen.weixin.kit.WeixinBasicKit;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import java.util.Properties;

/**
 * Created by Administrator on 2016/2/9.
 */
public class InitServlet extends HttpServlet{
    private static WebApplicationContext wc;
    private static String realpath;

    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        //初始化spring工厂
        wc = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
        realpath = config.getServletContext().getRealPath("");
        BeanFactoryContext.setWc(wc);

        WeixinBasicKit.setWeixinContext();

    }



    public static String getRealpath() {
        return realpath;
    }

    public static WebApplicationContext getWc() {
        return wc;
    }
}
